package br.edu.utfpr.backupTools.view.action.backup;

import br.edu.utfpr.backupTools.model.pojo.Backup;
import br.edu.utfpr.backupTools.util.enums.TipoConexao;
import br.edu.utfpr.backupTools.view.action.AbstractCommand;
import br.edu.utfpr.backupTools.view.action.strategy.impl.VerificaBackupLocal;
import br.edu.utfpr.backupTools.view.action.strategy.impl.VerificaBackupRemoto;
import br.edu.utfpr.comum.RetornoValidacao;

/**
 * Created with IntelliJ IDEA.
 * User: Luan
 * Date: 21/05/12
 * Time: 17:14
 * To change this template use File | Settings | File Templates.
 */
public class VerificaBackup extends AbstractCommand<Backup>{

    private boolean possuiBackup;

    @Override
    public RetornoValidacao execute(Backup backup) {
        verificaBackup = backup.getTipoConexao().equals(TipoConexao.LOCAL) ? new VerificaBackupLocal() : new VerificaBackupRemoto();
        possuiBackup = verificaBackup.possuiBackup(backup);
        return null;
    }

    public boolean isPossuiBackup(){
        return  possuiBackup;
    }
}
